package file;

import java.io.File;
import java.io.IOException;

//在当前目录下新建100个文件,命名为:test1.txt...test100.txt
public class Test {
    public static void main(String[] args) throws IOException {
        for (int i = 1; i < 101; i++) {
            File file = new File("./test"+i+".txt");
            if (file.exists()){
//                System.out.println("test."+i+"txt文件已存在");
                file.delete();
//                System.out.println("test."+i+"txt文件已删除");
            }else {
                file.createNewFile();
            }
        }
    }
}
